package com.itboye.jmsfhz.data.repository;

import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.google.gson.reflect.TypeToken;
import com.itboye.core.interfaces.ICompleteListener;
import com.itboye.core.utils.BaseErrorListener;
import com.itboye.core.utils.BaseSuccessReqListener;
import com.itboye.core.utils.ByJsonRequest.Builder;
import com.itboye.jmsfhz.data.interfaces.IRedBag;
import com.itboye.jmsfhz.data.model.GoodsAskQueryModel;
import com.itboye.jmsfhz.data.model.PersonDataBean;
import com.itboye.jmsfhz.data.model.RecruitBean;
import com.itboye.jmsfhz.data.model.RedBagModel;

public class RedBagRepository extends BaseNetRepository implements
		IRedBag<RecruitBean> {
	static final String UPDATE = "By_CompanyEmploy_query"; //招聘
	
	static final String CompanyApplyInfo = "By_CompanyApplyInfo_receive"; //我收到的

	public RedBagRepository(ICompleteListener listener) {
		super(listener);
		// TODO Auto-generated constructor stub
	}

	@Override
	public void add(RecruitBean model) {
		// TODO Auto-generated method stub
		Type type = new TypeToken<RecruitBean>() {
		}.getType();
		String apiVer = "103";	
		Map<String, Object> params = new HashMap<String, Object>();
		params.put("page_num", model.getPage_num());
		params.put("page_size", model.getPage_size());
		params.put("keywords", model.getKeywords());

		// 目前最简化调用
		// START
		(new Builder<RecruitBean>())
				.setTypeVerParamsAndReturnClass(UPDATE, apiVer, params,
						type)
				.requestListener(
						new BaseSuccessReqListener<RecruitBean>(getListener()))
				.errorListener(new BaseErrorListener(getListener()))
				.desEncodeThenBuildAndSend();
	}

	@Override
	public void delete(RecruitBean model) {
		// TODO Auto-generated method stub

	}

	@Override
	public void update(RecruitBean model) {
		// TODO Auto-generated method stub
		}

	@Override
	public void getInfo(RecruitBean model) {
		// TODO Auto-generated method stub
		Type type = new TypeToken<RecruitBean>() {
		}.getType();
		String apiVer = "103";	
		Map<String, Object> params = new HashMap<String, Object>();
		params.put("page_num", model.getPage_num());
		params.put("page_size", model.getPage_size());
		// 目前最简化调用
		// START
		(new Builder<RecruitBean>())
				.setTypeVerParamsAndReturnClass(UPDATE, apiVer, params,
						type)
				.requestListener(
						new BaseSuccessReqListener<RecruitBean>(getListener()))
				.errorListener(new BaseErrorListener(getListener()))
				.desEncodeThenBuildAndSend();
	}

	@Override
	public List<RecruitBean> query(RecruitBean model) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public void getkeywords(String page_num, String page_size, String keywords) {
		// TODO Auto-generated method stub
		Type type = new TypeToken<RecruitBean>() {
		}.getType();
		String apiVer = "103";	
		Map<String, Object> params = new HashMap<String, Object>();
		params.put("page_num",page_num);
		params.put("page_size",page_size);
		params.put("keywords", keywords);

		// 目前最简化调用
		// START
		(new Builder<RecruitBean>())
				.setTypeVerParamsAndReturnClass(UPDATE, apiVer, params,
						type)
				.requestListener(
						new BaseSuccessReqListener<RecruitBean>(getListener()))
				.errorListener(new BaseErrorListener(getListener()))
				.desEncodeThenBuildAndSend();
	}


}
